//@author A0105602X
#ifndef ITEM_H
#define ITEM_H

#include <fstream>
#include "Helper.h"

class Item{
protected:
	string venue;
	string name;
	string payer;
    double price;
    string category;
    string date;
public:
	virtual void writefile(char*); //an abstract method
	bool record();//record data
	bool recordName();
	bool recordPrice();
	bool recordDate();
	virtual bool recordExtra() = 0; 
	//post: record an extra field(venue for expense, payer for payment, necessity and category for budgetitem)
	virtual bool isexpense() = 0; //true for expense false for payment
	bool checkEmpty();
	void setCategory(string);
    virtual void record_from_file(ifstream&, streampos);
	//pre: take in a ifstream and the starting position of the item
	//post:retrieve this item from file
    string getName();
    double getPrice();
    string getCategory();
    string getDate();
	virtual void print();
	string getVenue();
	string getPayer();
	virtual bool compare(Item&); //compare Item& with this item, true if they are the same, false otherwise
};
#endif
